<?php
/**
 * Created by PhpStorm
 * User: Jhinwy
 * Date: 3/16/24
 * Time: 3:16 PM
 */

namespace app\adminapi\controller\order;


use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\order\OrderCallbackLists;
use app\adminapi\validate\order\OrderCallbackValidate;
use app\common\model\callback\OrderCallback;
use app\adminapi\logic\order\OrderCallbackLogic;


/**
 * Order控制器
 *
 * Class OrderController
 * @package app\adminapi\controller
 */
class OrderCallbackController extends BaseAdminController
{

    /**
     * @notes 订单回传列表
     *
     * @return \think\response\Json
     * @author likeadmin
     * @date 2024/02/01 10:45
     */
    public function lists()
    {
        $channelName = $this->request->get('channel_name', '');

        return $this->dataLists(new OrderCallbackLists($channelName));
    }

    /**
     * @notes 订单回传列表
     *
     * @return \think\response\Json
     * @author likeadmin
     * @date 2024/02/01 10:45
     */
    public function orderReturn()
    {
        $params = (new OrderCallbackValidate())->post()->goCheck('orderReturn');

        $result = OrderCallbackLogic::orderReturn($params);
        if (true === $result) {
            return $this->success('回传成功', [], 1, 1);
        }
        return $this->fail(OrderCallbackLogic::getError());
    }
}
